1. Introduction > 1.10 Serial Interface Flow Control > 1.10.2 Hardware Flow Control (RTS/CTS Handshake)

1.10.2
Hardware flow control sets or resets the RTS/CTS wires. This approach is faster and more reliable, and there­fore, the better choice. When the HWM is reached, CTS is set inactive. When the LWM is passed, CTS goes active again. To achieve smooth data flow, ensure that the RTS/CTS lines are present on your application plat­form.

Configuring hardware flow control
•
Hardware flow control must be set on both sides: with AT\Q3 or AT+IFC in the ME and an equivalent RTS/CTS handshake option in the host application.
•
The default setting of the ME is AT\Q0 (no flow control) which must be altered to AT\Q3 (RTS/CTS hardware handshake on). The setting is stored volatile and must be restored each time after rebooting the ME.
•
AT\Q has no read command. To verify the current setting of AT\Q, simply check the settings of the active profile with AT&V.
•
Often, fax programs run an intialization procedure when started up. The intialization commonly includes enabling RTS/CTS hardware handshake, eliminating the need to set AT\Q3 once again. However, before set­ting up a CSD call, you are advised to check that RTS/CTS handshake is set.


Buffer design considerations
•
•
Uplink direction (where ME is receiving data from host application):
CTS control is based on the filling level of the ME's receive buffer. When the application detects that CTS is being deactivated it must instantly stop sending data to the ME's receive buffer. But still, after deactivation of CTS, the receive buffer of the ME can accept another 512 bytes.
•
Downlink direction (where ME is sending data to host application):
The transmit buffer of the ME can hold at least 1024 bytes. After deactivation of RTS the ME sends max. 2 more bytes and then stops transferring data to the application.
The maximum time RTS can be kept inactive without losing data is determined by the buffer size and the max­imum possible over-the-air data rate. In any case, the local data rate between DCE and DTE (AT+IPR) should be set to a value higher than the maximum possible over-the-air data rate.
•
Buffer size recommended for the host application:
Just like the ME, the host application should include send and receive buffers for each serial interface. To handle large amounts of data at high speed a buffer capacity of 1024 bytes is recommended. If the host appli­cation is designed mainly for one direction (uplink or downlink) a lower buffer size will do for the direction where less data is transferred.
In fact, the optimal size of the host application buffers is a matter of finding the balance between the amount of data, data throughput, reaction time of the application when handling the buffer, processor performance and available memory. To give an example, a small buffer size (such as 256 bytes) increases the frequency of deactivating RTS/CTS and the frequency of flushing the buffer, thus diminishing the efficiency of the appli­cation.
Also, please consider that RTS/CTS flow control cannot stop the data stream coming from the network, e.g. in a GPRS or fax connection. So the lack of appropriate hardware flow control increases the risk of losing data packets if, like in the case of UDP, the connection protocol has no or only minimum error handling functions. Other network protocols are using high level flow control mechanisms. For example, to prevent loss of data the TCP protocol uses retransmission algorithms, fax applications usually repeat the transfer of faulty pages.